ia.PieLayer Class
The base class for pie layers.
Constructor
ia.PieLayer
    
        ()
    
    
    
    
    
    
    
    
    
    Item Index
Methods
- _addToSelection
 - _clearCanvas
 - _clearHighlightGraphics
 - _clearLabelGraphics
 - _clearLayerGraphics
 - _clearSelectionGraphics
 - _dispatchItemEvent
 - _drawItem
 - _hitTest
 - _itemEventHandler
 - _mapEventHandler
 - _pointInPoly
 - _pointInSlice
 - _removeFromSelection
 - _renderItem
 - _setLabelStyle
 - _triggerRenderSelection
 - addCanvases
 - addEventListener
 - clear
 - clearHighlight
 - clearItems
 - clearSelection
 - createCanvas
 - dispatchEvent
 - getData
 - getItem
 - getVisible
 - hideTip
 - highlight
 - highlightItem
 - hitItem
 - isSelected
 - loadSource
 - removeCanvases
 - removeListener
 - render
 - renderSelection
 - select
 - selectAll
 - selectItem
 - setData
 - setMap
 - setVisible
 - showTip
 - tipFunction
 - unselect
 - update
 
Properties
- animationMode
 - bBox
 - canvas
 - context
 - dataChanged
 - dataField
 - doHitTest
 - highlightCanvas
 - highlightColor
 - highlightContext
 - id
 - interactive
 - isLegendComponent
 - isLoaded
 - itemArray
 - items
 - labelContext
 - map
 - name
 - selectionCanvas
 - selectionColor
 - selectionContext
 - selectionIds
 - showDataTips
 - showInLayerList
 - showLabels
 - style
 - symbol
 - thematic
 - tip
 
Methods
_addToSelection
    
        - 
                    
                        
id 
Adds an id to the selection.
Parameters:
- 
                    
                        
idStringThe id of the item.
 
_clearCanvas
    
        - 
                    
                        
c - 
                    
                        
ctx 
Clears a canvas.
Parameters:
- 
                    
                        
cHTML CanvasThe canvas to clear.
 - 
                    
                        
ctxHTML Canvas ContextIts context.
 
_clearHighlightGraphics
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Clears the highlight canvas.
_clearLabelGraphics
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Clears the label canvas.
_clearLayerGraphics
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Clears the layer canvases.
_clearSelectionGraphics
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Clears the selection canvas.
_dispatchItemEvent
    
        - 
                    
                        
event - 
                    
                        
isHit - 
                    
                        
item 
The hit logic for items in the layer.
Parameters:
- 
                    
                        
eventia.MapMouseEventA
ia.MapMouseEvent. - 
                    
                        
isHitBooleanIndicates if the item was hit.
 - 
                    
                        
itemObjectThe item that was hit.
 
_drawItem
    
        - 
                    
                        
item - 
                    
                        
ctx 
Does the actual drawing.
Parameters:
- 
                    
                        
itemObjectThe item.
 - 
                    
                        
ctxHTML Canvas ContextThe context to render to.
 
_hitTest
    
        - 
                    
                        
event 
Runs a hit test on the layer.
Parameters:
- 
                    
                        
eventia.MapMouseEventA
ia.MapMouseEvent. 
_itemEventHandler
    
        - 
                    
                        
event 
Handles default selection / highlight functionality.
Parameters:
- 
                    
                        
eventia.ItemEventAn
ia.ItemEventdispatched by this layer. 
_mapEventHandler
    
        - 
                    
                        
event 
Handles when to carry out hit tests.
Parameters:
- 
                    
                        
eventia.MapMouseEventA
ia.MapMouseEvent. 
_pointInPoly
    
        - 
                    
                        
coords - 
                    
                        
pointX - 
                    
                        
pointY 
Query if a point lies completely within a polygon.
Parameters:
- 
                    
                        
coordsNumberThe coords to hit test.
 - 
                    
                        
pointXNumberThe x coordinate of the test point.
 - 
                    
                        
pointYNumberThe y coordinate of the test point.
 
_pointInSlice
    
        - 
                    
                        
item - 
                    
                        
pointX - 
                    
                        
pointY 
Query if a point lies completely within a pie slice.
Parameters:
- 
                    
                        
itemObjectThe item to hit test.
 - 
                    
                        
pointXNumberThe x coordinate of the test point.
 - 
                    
                        
pointYNumberThe y coordinate of the test point.
 
_removeFromSelection
    
        - 
                    
                        
id 
Removes an id from the selection.
Parameters:
- 
                    
                        
idStringThe id of the item.
 
_renderItem
    
        - 
                    
                        
item 
Renders the item to the given context.
Parameters:
- 
                    
                        
itemObjectThe item.
 
_setLabelStyle
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Sets the label style.
_triggerRenderSelection
    
        ()
    
    
    
    
        private
    
    
    
    
    
    
    Triggers a selection render. Prevents over rendering which results in a frozen browser.
addCanvases
    
        ()
    
    
    
    
    
    
    
    
    
    Adds drawing canvases for the layer when the layer is shown. This method was introduced to fix a bug a chrome when multiple canvases were affecting rendering. It basically reduces the number of unused canvases which are taking up memory.
addEventListener
    
        - 
                    
                        
eventType - 
                    
                        
fnc - 
                    
                        
obj 
Add an event listener.
Parameters:
- 
                    
                        
eventTypeStringThe type of event to listen for.
 - 
                    
                        
fncFunctionThe function to call when the event occurs.
 - 
                    
                        
objObjectAn optional parent object.
 
clear
    
        ()
    
    
    
    
    
    
    
    
    
    Clears all canvases in the layer.
clearHighlight
    
        ()
    
    
    
    
    
    
    
    
    
    Clears all highlights.
clearItems
    
        ()
    
    
    
    
    
    
    
    
    
    Clears the item list.
clearSelection
    
        ()
    
    
    
    
    
    
    
    
    
    Clears all selections.
createCanvas
    
        ()
    
    
        
            HTML Canvas
        
    
    
    
    
    
    
    
    
    Creates a new canvas.
Returns:
dispatchEvent
    
        - 
                    
                        
event 
Dispatch an event to the listeners.
Parameters:
- 
                    
                        
eventObjectThe event object.
 
getData
    
        ()
    
    
        
            Id:"eh11", name:"polwarth", value:2345, associate1:25
        
    
    
    
    
    
    
    
    
    Gets a data object for the layer.
Returns:
getItem
    
        - 
                    
                        
id 
Gets an item with the given id.
Parameters:
- 
                    
                        
idStringThe id of the item to get.
 
getVisible
    
        ()
    
    
        
            Boolean
        
    
    
    
    
    
    
    
    
    Gets the visibility of the layer.
Returns:
hideTip
    
        ()
    
    
    
    
    
    
    
    
    
    Hides the tip.
highlight
    
        - 
                    
                        
id 
Hightlights an item.
Parameters:
- 
                    
                        
idStringThe id of the item to highlight.
 
highlightItem
    
        - 
                    
                        
item 
Highlights the item.
Parameters:
- 
                    
                        
itemObjectThe item.
 
hitItem
    
        - 
                    
                        
item - 
                    
                        
event 
Runs a hit test on an item.
Parameters:
- 
                    
                        
itemObjectThe item to hit test.
 - 
                    
                        
eventia.MapMouseEventAn
ia.MapMouseEvent. 
isSelected
    
        - 
                    
                        
id 
Checks if an id is selected
Parameters:
- 
                    
                        
idStringThe id of the item.
 
loadSource
    
        ()
    
    
    
    
    
    
    
    
    
    Loads the source data.
removeCanvases
    
        ()
    
    
    
    
    
    
    
    
    
    Removes drawing canvases for the layer when the layer is hidden. This method was introduced to fix a bug a chrome when multiple canvases were affecting rendering. It basically reduces the number of unused canvases which are taking up memory.
removeListener
    
        - 
                    
                        
obj 
Removes all event listeners for the given object.
Parameters:
- 
                    
                        
objObjectThe object.
 
render
    
        ()
    
    
    
    
    
    
    
    
    
    Renders the data.
renderSelection
    
        ()
    
    
    
    
    
    
    
    
    
    Renders the selection canvas.
select
    
        - 
                    
                        
id 
Selects an item.
Parameters:
- 
                    
                        
idStringThe id of the item.
 
selectAll
    
        ()
    
    
    
    
    
    
    
    
    
    Selects all the items in the layer.
selectItem
    
        - 
                    
                        
item 
Selects the item.
Parameters:
- 
                    
                        
itemObjectThe item.
 
setData
    
        - 
                    
                        
value 
Sets a data object for the layer.
Parameters:
- 
                    
                        
valueId:"eh11", name:"polwarth", value:2345, associate1:25["eh11"]
["eh12"]{id:"eh12", name:"morningside", value:4347, associate1:45}
["eh13"]{id:"eh13", name:"merchiston", value:2496, associate1:25} 
setMap
    
        - 
                    
                        
map - 
                    
                        
map 
Sets the map and canvas for the layer.
Parameters:
- 
                    
                        
mapia.MapThe map.
 - 
                    
                        
mapHTML ElementThe container.
 
setVisible
    
        - 
                    
                        
value 
Sets the visibility of the layer.
Parameters:
- 
                    
                        
valueBooleantrue/false.
 
showTip
    
        - 
                    
                        
item - 
                    
                        
event 
Displays the tip for the passed item
Parameters:
- 
                    
                        
itemObjectThe map item.
 - 
                    
                        
eventia.ItemEventAn
ia.ItemEvent. 
tipFunction
    
        - 
                    
                        
item 
Supplies the default text for the layer. This can be replaced with a custom function
Parameters:
- 
                    
                        
itemObjectThe map item.
 
unselect
    
        - 
                    
                        
id 
Unselects an item.
Parameters:
- 
                    
                        
idStringThe id of the item.
 
update
    
        ()
    
    
    
    
    
    
    
    
    
    Updates the data.
Properties
animationMode
    Boolean
    
    
    
    
    
    Animation mode.
Default: false
canvas
    HTML Canvas
    
    
    
    
    
    The canvas associated with this layer.
context
    HTML Canvas Context
    
    
    
    
    
    The canvas context associated with this layer.
dataChanged
    Boolean
    
    
    
    
    
    Indicates the data has changed.
Default: false
dataField
    String
    
    
    
    
    
    Specifies the field of the data provider that provides the values.
Default: "value"
doHitTest
    Boolean
    
    
    
    
    
    Indicates whether to carry out a hit test.
Default: true
highlightCanvas
    HTML Canvas
    
    
    
    
    
    The highlight canvas associated with this layer.
highlightColor
    String
    
    
    
    
    
    The item highlight color.
Default: "#00ff00"
highlightContext
    HTML Canvas Context
    
    
    
    
    
    The highlight canvas context associated with this layer.
id
    String
    
    
    
    
    
    The id of the layer.
Default: ""
interactive
    Boolean
    
    
    
    
    
    Is selection and highlighting switched on.
Default: false
isLegendComponent
    Boolean
    
    
    
    
    
    Indicates this is a legend component.
Default: true
isLoaded
    Boolean
    
    
    
    
    
    Indicates whether the layer is loaded.
Default: false
itemArray
    Object
    
    
    
    
    
    An array containing the layer items.
items
    Associative Array
    
    
    
    
    
    An associate array containing the layer items.
labelContext
    HTML Canvas Context
    
    
    
    
    
    The label canvas context associated with this layer.
name
    String
    
    
    
    
    
    The name of the layer.
Default: ""
selectionCanvas
    HTML Canvas
    
    
    
    
    
    The selection canvas associated with this layer.
selectionColor
    String
    
    
    
    
    
    The item selection color.
Default: "#ff0000"E
selectionContext
    HTML Canvas Context
    
    
    
    
    
    The selection canvas context associated with this layer.
selectionIds
    String
    
    
    
    
    
    An array of selected ids.
showDataTips
    Boolean
    
    
    
    
    
    Are data tips displayed.
Default: trueE
showInLayerList
    Boolean
    
    
    
    
    
    Should the layer be displayed ina layer list.
Default: false
showLabels
    Boolean
    
    
    
    
    
    Show labels.
Default: false
style
    Object
    
    
    
    
    
    The layer style.
Default: {fillStyle:'#EFEFEF', strokeStyle:'#CCCCCC', lineWidth:'1', lineJoin:'round'}
symbol
    String
    
    
    
    
    
    The label canvas associated with this layer.
Default: ia.Shape.SQUARE
tip
    String
    
    
    
    
    
    The data tip - used by charts that have fixed tip templates.
Default: ""